package sv.gob.mh.dgii.model;

// Generated Dec 12, 2007 1:25:05 PM by Hibernate Tools 3.2.0.CR1

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * DvColectivo generated by hbm2java
 */
@Entity
@Table(name = "DV_COLECTIVO", schema = "DEVOLUCIONES")
public class DvColectivo implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1206676605187509278L;
	private DvColectivoId id;
	private TbObligacion tbObligacion;
	private TbDepartamento tbDepartamento;
	private Long ncolectivo;
	private Date fhultimaEmision;
	private Long nultCheque;
	private Set<DvMedioDevol> dvMedioDevols = new HashSet<DvMedioDevol>(0);

	public DvColectivo() {
	}

	public DvColectivo(DvColectivoId id, TbObligacion tbObligacion,
			TbDepartamento tbDepartamento, Long ncolectivo) {
		this.id = id;
		this.tbObligacion = tbObligacion;
		this.tbDepartamento = tbDepartamento;
		this.ncolectivo = ncolectivo;
	}

	public DvColectivo(DvColectivoId id, TbObligacion tbObligacion,
			TbDepartamento tbDepartamento, Long ncolectivo,
			Date fhultimaEmision, Long nultCheque,
			Set<DvMedioDevol> dvMedioDevols) {
		this.id = id;
		this.tbObligacion = tbObligacion;
		this.tbDepartamento = tbDepartamento;
		this.ncolectivo = ncolectivo;
		this.fhultimaEmision = fhultimaEmision;
		this.nultCheque = nultCheque;
		this.dvMedioDevols = dvMedioDevols;
	}

	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "cdepartamento", column = @Column(name = "C_DEPARTAMENTO", nullable = false, length = 2)),
			@AttributeOverride(name = "facolectivo", column = @Column(name = "FA_COLECTIVO", nullable = false, length = 4)) })
	public DvColectivoId getId() {
		return this.id;
	}

	public void setId(DvColectivoId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_OBLIGACION", nullable = false)
	public TbObligacion getTbObligacion() {
		return this.tbObligacion;
	}

	public void setTbObligacion(TbObligacion tbObligacion) {
		this.tbObligacion = tbObligacion;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "C_DEPARTAMENTO", nullable = false, insertable = false, updatable = false)
	public TbDepartamento getTbDepartamento() {
		return this.tbDepartamento;
	}

	public void setTbDepartamento(TbDepartamento tbDepartamento) {
		this.tbDepartamento = tbDepartamento;
	}

	@Column(name = "N_COLECTIVO", nullable = false, precision = 10, scale = 0)
	public Long getNcolectivo() {
		return this.ncolectivo;
	}

	public void setNcolectivo(Long ncolectivo) {
		this.ncolectivo = ncolectivo;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "FH_ULTIMA_EMISION", length = 7)
	public Date getFhultimaEmision() {
		return this.fhultimaEmision;
	}

	public void setFhultimaEmision(Date fhultimaEmision) {
		this.fhultimaEmision = fhultimaEmision;
	}

	@Column(name = "N_ULT_CHEQUE", precision = 10, scale = 0)
	public Long getNultCheque() {
		return this.nultCheque;
	}

	public void setNultCheque(Long nultCheque) {
		this.nultCheque = nultCheque;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "dvColectivo")
	public Set<DvMedioDevol> getDvMedioDevols() {
		return this.dvMedioDevols;
	}

	public void setDvMedioDevols(Set<DvMedioDevol> dvMedioDevols) {
		this.dvMedioDevols = dvMedioDevols;
	}

}
